package exception;
/*
异常处理方式
try{

}catch(XXXException  e){

}
 */
public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        try {
            String a=null;
            String line="";
            System.out.println(a.length());
            System.out.println(line.charAt(0));
        }catch (StringIndexOutOfBoundsException |NullPointerException e){
            System.out.println("下标越界异常");
        }
        System.out.println("程序结束了");
    }
}
